﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Card.Security;

namespace Card.Web.Controls
{
    public partial class TopUserInfo : UserControlBasePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            this.DoInit();
        }

        private void DoInit()
        {
            if (this.Passport.IsLogin)
            {
                this.login.Visible = false;
                this.userInfo.Visible = true;
                this.ltlUserName.Text = this.Passport.UserName;
                int cartCount = 0;
                int.TryParse(CookieManager.GetCookie(CONST.CookieNames.CartRecord), out cartCount);
                this.spCartCount.InnerText = cartCount.ToString();                
            }            
        }
    }
}